Most QuickDraw routines do not return result codes. However, you can use the QDError function to get a result code from the last applicable Color QuickDraw or Color Manager routine that you called.
To get a result code from the last applicable Color QuickDraw or Color Manager routine that you called, use the QDError function.
FUNCTION QDError: Integer;
The QDError function returns the error result from the last applicable Color QuickDraw or Color Manager routine. On a system with only basic QuickDraw, QDError always returns noErr .
The QDError function is helpful in determining whether insufficient memory caused a drawing operation--particularly those involving regions, polygons, pictures, and images copied with CopyBits --to fail in Color QuickDraw.
Basic QuickDraw uses stack space for work buffers. For complex operations such as depth conversion, dithering, and image resizing, stack space may not be sufficient. Color QuickDraw attempts to get temporary memory from other parts of the system. If that is still not enough, QDError returns the nsStackErr error. If your application receives this result, reduce the memory required by the operation--for example, divide the image into left and right halves--and try again.
When you record drawing operations in an open region, the resulting region description may overflow the 64 KB limit. Should this happen, QDError returns regionTooBigError . Since the resulting region is potentially corrupt, the CloseRgn procedure (described in the chapter "QuickDraw Drawing" in this book) returns an empty region if it detects QDError has returned regionTooBigError . A similar error, rgnTooBigErr , can occur when using the BitMapToRegion function (described in the chapter "Basic QuickDraw" in this book) to convert a bitmap to a region.
The BitMapToRegion function can also generate the pixmapTooDeepErr error if a PixMap record is supplied that is greater than 1 bit per pixel. You may be able to recover from this problem by coercing your PixMap record into a 1-bit PixMap record and calling the BitMapToRegion function again.
In addition to these result codes, QDErr also returns result codes from the Memory Manager.
Listing 7-8 on page 7-20 in the chapter "Pictures" in this book--illustrate how to use QDError to report insufficient memory conditions for various drawing operations.
The NewGWorld function is described in the chapter "Offscreen Graphics Worlds" in this book. The Color2Index function and the MakeITable procedure are described in the chapter "Color Manager" in Inside Macintosh: Advanced Color Imaging . Graphics devices are described in the chapter "Graphics Devices" in this book. Memory Manager result codes are listed in Inside Macintosh: Memory .